import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SaleOutWarehouseOrderVO, SaleOutWarehouseOrderForm, SaleOutWarehouseOrderQuery } from '@/api/jdAndJstSceneClassification/consignmentSale/jdSaleOutWarehouseOrder/types';

/**
 * 查询金蝶-销售出库单列表
 * @param query
 * @returns {*}
 */

export const listSaleOutWarehouseOrder = (query?: SaleOutWarehouseOrderQuery): AxiosPromise<SaleOutWarehouseOrderVO[]> => {
  return request({
    url: '/dataCheck/jd/saleOutWarehouseOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询金蝶-销售出库单列表
 * 01、定义后端接口
 * @param query
 * @returns {*}
 */
export const listSaleOutWarehouseOrderByCustomer1 = (query?: SaleOutWarehouseOrderQuery): AxiosPromise<SaleOutWarehouseOrderVO[]> => {
  return request({
    url: '/dataCheck/jd/saleOutWarehouseOrder/list-by-customer1',
    method: 'get',
    params: query
  });
};

/**
 * 查询金蝶-销售出库单详细
 * @param id
 */
export const getSaleOutWarehouseOrder = (id: string | number): AxiosPromise<SaleOutWarehouseOrderVO> => {
  return request({
    url: '/dataCheck/jd/saleOutWarehouseOrder/' + id,
    method: 'get'
  });
};

/**
 * 新增金蝶-销售出库单
 * @param data
 */
export const addSaleOutWarehouseOrder = (data: SaleOutWarehouseOrderForm) => {
  return request({
    url: '/dataCheck/jd/saleOutWarehouseOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改金蝶-销售出库单
 * @param data
 */
export const updateSaleOutWarehouseOrder = (data: SaleOutWarehouseOrderForm) => {
  return request({
    url: '/dataCheck/jd/saleOutWarehouseOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除金蝶-销售出库单
 * @param id
 */
export const delSaleOutWarehouseOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/dataCheck/jd/saleOutWarehouseOrder/' + id,
    method: 'delete'
  });
};
